package com.test.rest.server;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;

import com.test.rest.service.CategoryService;

public class Server {

	public static void main(String[] args) {
		
		JAXRSServerFactoryBean factory = new JAXRSServerFactoryBean();
		
		factory.getInInterceptors().add(new LoggingInInterceptor());
		factory.getOutInterceptors().add(new LoggingOutInterceptor());
		
		factory.setResourceClasses(CategoryService.class);
		factory.setResourceProvider(CategoryService.class, new SingletonResourceProvider(new CategoryService()));
		
		factory.setAddress("http://localhost:9000/");
		
		factory.create();
	}
	
}
